from rest_framework import serializers

from goods.models import GoodsVisitCount


class GoodsDaySerializer(serializers.ModelSerializer):
    category = serializers.StringRelatedField(read_only=True)  # 返回的是外键关联表的__str__方法返回的值，PrimaryRelatedField返回的是id

    class Meta:
        model = GoodsVisitCount
        fields = ('category', 'count')
